#!/usr/bin/env node

const {EventEmitter}= require('events');

const evt=new EventEmitter();

evt.on('hello',()=>{
    console.log('hello event happen!')
})
evt.on('bye',()=>{
    console.log('good bye!')
    process.exit();
})
setInterval(()=>{
    evt.emit('hello')
},1000);

setTimeout(()=>{
    evt.emit('bye');
},5000)